# add a descriptive label to a variable
Label(d.diamonds$colour) <- "The rating scale applied to diamonds ranges from colorless
to yellow, as any other color is extremely rare."
# technically just appending the text as attribute to the variable
attributes(d.diamonds$colour)
# label is supported while describing data
Desc(d.diamonds$colour)
# The label can be deleted by setting it to NULL
Label(d.diamonds$colour) <- NULL
# Labelling the columns of a data.frame is best done with a loop
# (all so far seen *apply aproaches lead to more complicated code...)
lbl <- RndWord(16, 7)
for(i in seq_along(lbl))
Label(d.pizza[, i]) <- lbl[i]
Str(d.pizza)
Run the code above in your browser using DataLab